package bdqn.t09.controller;

import bdqn.t09.pojo.AsCustoms;
import bdqn.t09.pojo.AsKeywords;
import bdqn.t09.pojo.AsSystemconfig;
import bdqn.t09.service.AsCustomsService;
import bdqn.t09.service.AsKeywordsService;
import bdqn.t09.service.AsSystemconfigService;
import com.alibaba.fastjson.JSON;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
public class AsKeywordsController {

    @Resource
    private AsKeywordsService asKeywordsService;

    @Resource
    private AsCustomsService asCustomsService;

    @Resource
    private AsSystemconfigService asSystemconfigService;

//    查找客户信息
    @RequestMapping(value = "select",method = RequestMethod.POST)
    @ResponseBody
    public Object selectAsCustoms(){
        List<AsCustoms> asCustoms1 = asCustomsService.asCustomsList();
        return asCustoms1;
    }

    //    查找客户信息2
    @RequestMapping(value = "select3",method = RequestMethod.POST)
    @ResponseBody
    public Object selectCustom(){
        List<AsKeywords> asKeywords = asKeywordsService.asKeywordsList();
        return asKeywords;
    }

    @RequestMapping(value = "selectasSystemconfig",method = RequestMethod.GET)
    @ResponseBody
    public Object asSystemconfig(){
        int count = asKeywordsService.asKeywordsList2();
        return count;
    }



//    查找服务报价
    @RequestMapping(value = "select2",method = RequestMethod.POST)
    @ResponseBody
    public Object selectAsSystemconfig(){
        List<AsSystemconfig> asSystemconfigs = asSystemconfigService.asSystemconfigList();
        return asSystemconfigs;
    }

//    提交表单
    @RequestMapping(value = "tijiao",method = RequestMethod.GET)
    @ResponseBody
    public Object tijiao(AsKeywords record){
        int count = asKeywordsService.insertSelective(record);
        return count;
    }

    @RequestMapping(value ={"/ak47"},method = RequestMethod.GET)
    public String goUserLogin(){
        return  "asKeywords";
    }

    @RequestMapping(value ={"/ak48"},method = RequestMethod.GET)
    public String tobaobiao(){
        return  "reportanagement";
    }


    //查关键词是否存在
    @RequestMapping(value = "ChaKeywords",method = RequestMethod.GET)
    @ResponseBody
    public Object chaKeywords(String keywords){
        AsKeywords asKeywords = asKeywordsService.chaKeywords(keywords);
        if(asKeywords != null){
            return asKeywords;
        }
       return null;
    }
}
